import { get, post,filepost } from "../api/axios";

//注册功能

//获取验证码
export const getEmailCode = (email) => get('/mallEmail/sendRegisterCode/'+email);

//注册用户
export const registerUser = (params) => post('/mallUser/registerUser', params);

//登陆用户
export const loginUser = (params) => post('/mallUser/loginUser', params);

//跳转支付宝登陆页面
export const alilogin = (params) => get('/mallUser/aliLogin');



//获取商品分类
export const getGoodType =() => get('/mallGoodType/allGoodType');

//获取轮播图页面
export const getCarouel = () => get('/mallCarousel/getCarousels');


// 商品相关
//搜索相关商品
export const getHotKey = () => get('/search/hotKeys');

export const searchGood = (keyword) => get('/search/searchGood/' + keyword);
// 根据商品分类搜索商品信息
export const searchGoodByType = (params) => post('/search/searchGoodByType', params);

//搜索商品详情信息
export const searchGoodDetail =(params)=> post('/search/searchGoodDetail',params)

//获取最新商品信息
export const getNewGoodInfo = () => get('/mallGood/newGoods');

//获取热卖商品信息
export const getHotGoodInfo = () => get('/mallGood/hotGoods');

// 获取特惠商品信息列表
export const getSecKillGoodInfo = () => get('/mallSecKill/getList');

//获取某一商品信息
export const getGoodDetail = (params) => get('/mallGood/getGoodById/' + params);

//获取某个商品的评论
export const getGoodComment = (params) => post('/mallComment/goodComment', params);

//添加一条回复
export const addReply = (params) => post('/mallComment/addReply', params);




//秒杀该商品
export const SecKillGood = (params) => post('/mallSecKill/SecKillGood', params);


//添加商品到购物车
export const addGoodCart = (params) => get('/mallCart/addGoodCart/'+params);

//获取用户的购物车
export const getUserCart = () => get("/mallCart/getUserCart");


//增加购物车商品的数量
export const addGoodCartCount = (goodId) => get("/mallCart/addGoodCount/" + goodId);

//减少购物车商品的数量
export const subGoodCartCount = (goodId) => get("/mallCart/subGoodCount/" + goodId);

//删除购物车的商品
export const delGoodCart = (parmas) => post("/mallCart/delGoodCart", parmas);


//获取用户收获地址信息
export const getUserAddress = () => get("/mallUserAddress/getUserAddress")

//修改或添加用户地址信息
export const editUserAddress = (params) => post("/mallUserAddress/edit", params)

//删除用户信息
export const delUserAddress = (params)=>get("/mallUserAddress/del/"+params)



//创建订单
export const createdUserOrder = (params) => post("/mallOrder/createdOrder", params);

//获取用户全部订单
export const getuserOrder = () => get("/mallOrder/getUserOrder");


//获取用户评价的订单
export const getUserComment = () => get("/mallComment/userComment");

//评论商品
export const addGoodComment = (data) => post("/mallComment/addComment", data);



//普通支付订单
export const payOrder = (params) => get("/mallpay/pay", params);

//支付宝支付订单
export const aiPayOrder = (params) => post("/mallpay/alipay", params);



//用户信息管理

//获取用户的基本信息
export const getUserInfo = (params) => get("/mallUser/getUserInfo");

//修改用户基本信息
export const updateUserinfo = (params) => post("/mallUser/update/userInfo", params);

//修改用户头像
export const updateUserImg = (params) => filepost("/mallUser/update/userImg", params);

//获取修改密码的验证码
export const getPasswordCode = (email) => get("/mallEmail/sendPasswordCode/" + email);

//修改密码
export const updatePassword = (params)=> post("/mallUser/update/userPassword",params)